﻿namespace IteratorDemo
{
    internal class ListAggregate : IAggregate
    {
        private List<int> collectionn;
        public ListAggregate()
        {
            collectionn = new List<int>();
        }
        public IIterator CreateIterator()
        {
            return new ListIterator(this);
        }

        public int Count
        {
            get { return collectionn.Count; }
        }

        public int this[int index]
        {
            get { return collectionn[index]; }
            set { collectionn[index] = value; }
        }

        public void Insert(int value)
        {
            collectionn.Add(value);
        }
    }
}
